
def ms_tserver_email_1():
  """Email to InboundEmailVRP, route to EmailDN1, answer, release"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)

def ms_tserver_email_2():
  """Email to InboundEmailVRP, route to EmailDN1, answer, single step transfer, answer, release"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.SingleStepTransfer(InboundEmailVRP)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN2)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN2.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN2.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)

def ms_tserver_email_3():
  """Email to InboundEmailVRP, route to EmailDN1, answer, double single step transfer"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.SingleStepTransfer(InboundEmailVRP)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN2)
  EmailDN2.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN2.SingleStepTransfer(InboundEmailVRP)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN2)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN2.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN2.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
  
def ms_tserver_email_4():
  """Email to InboundEmailVRP, route to EmailDN1, silence, route to EmailDN2, answer, release"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.Silence()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN2)
  EmailDN2.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN2.ReleaseCall()
  EmailAgent1.SetReady(ACD1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
  
  
def ms_tserver_email_5():
  """Email to InboundEmailVRP, route to EmailDN1, agent set not ready, route to EmailDN2, answer, release"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailAgent1.SetNotReady(ACD1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN2)
  EmailDN2.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN2.ReleaseCall()
  EmailAgent1.SetReady(ACD1)  
  
def ms_tserver_email_6():
  """Email to InboundEmailVRP, route to EmailDN1, agent trying to logout in ringing, answer, release"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  EmailAgent1.Logout(ACD1) # error
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.ReleaseCall()
  
def ms_tserver_email_7():
  """Email to InboundEmailVRP, route to EmailDN1, answer, agent trying to logout in established, release"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  EmailDN1.AnswerCall()
  EmailAgent1.Logout(ACD1) # error
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2') 
  EmailDN1.ReleaseCall()
   
   
def ms_tserver_email_8():
  """Unregister VPR when call is on VRP"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.Unregister()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '4')
  InboundEmailVRP.Register()  
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2') 
  EmailDN1.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1) 

def ms_tserver_email_9():
  """Unregister VPR when call is routed to DN, DN is ringing"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID  
  InboundEmailVRP.RouteCall(EmailDN1)
  InboundEmailVRP.Unregister()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  InboundEmailVRP.Register()  
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2') 
  EmailDN1.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1) 

  
def ms_tserver_email_10():
  """Unregister VPR when call is routed to DN, DN answered"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID  
  InboundEmailVRP.RouteCall(EmailDN1)
  EmailDN1.AnswerCall()  
  InboundEmailVRP.Unregister()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  InboundEmailVRP.Register()  
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2') 
  EmailDN1.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1) 

  
def ms_tserver_email_11():
  """Unregister DN when DN is ringing"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID  
  InboundEmailVRP.RouteCall(EmailDN1)
  EmailDN1.Unregister()  
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  EmailDN1.Register()   
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)  
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
    
    
def ms_tserver_email_12():
  """Unregister DN when DN answered"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID  
  InboundEmailVRP.RouteCall(EmailDN1)
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.Unregister()  
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.Register()   
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
         

def ms_tserver_email_13():
  """Email to InboundEmailVRP, route to EmailDN1, answer, release, make call (Reply), release"""
  Customer1.SendEmail(DefaultEmail, "just test", "", InboundEmailVRP)
  cl = InboundEmailVRP.GetCall()
  interactionID = cl.interactionID
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  InboundEmailVRP.RouteCall(EmailDN1)
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  EmailDN1.AnswerCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  EmailDN1.ReleaseCall()
  InboundEmailVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
  EmailDN1.MakeCall(interactionID)
  cl = EmailDN1.GetCall()
  connID = cl.ConnID
  EmailDN1.tserver.CheckInteractionStatusByConnID(connID, expectedStatus = '10')
  EmailDN1.ReleaseCall()
  EmailDN1.tserver.CheckInteractionStatusByConnID(connID, expectedStatus = -1)
  
def ms_tserver_chat_1():
  """Chat to ChatVRP, route to ChatDN1, answer, release"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN1)
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  ChatDN1.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  Customer1.SendChatMessage("Hello!")
  ChatDN1.ReleaseCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
  Customer1.DisconnectChat()
  

def ms_tserver_chat_2():
  """Chat to ChatVRP, route to ChatDN1, answer, single step transfer, answer, release"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN1)
  ChatDN1.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN1.SingleStepTransfer(ChatVRP)
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN2)
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  ChatDN2.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  Customer1.SendChatMessage("Hello!")  
  ChatDN2.ReleaseCall()
  Customer1.DisconnectChat()
  
def ms_tserver_chat_3():
  """Chat to ChatVRP, route to ChatDN1, answer, double single step transfer"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN1)
  ChatDN1.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN1.SingleStepTransfer(ChatVRP)
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN2)
  ChatDN2.AnswerCall()
  Customer1.SendChatMessage("Hello!")  
  ChatDN2.SingleStepTransfer(ChatVRP)
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN2)
  ChatDN2.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN2.ReleaseCall()
  Customer1.DisconnectChat()
  
def ms_tserver_chat_4():
  """Chat to ChatVRP, route to ChatDN1, silence, route to ChatDN2, answer, release"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN1)
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  ChatDN1.Silence()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN2)
  ChatDN2.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  Customer1.SendChatMessage("Hello!")
  ChatDN2.ReleaseCall()
  Customer1.DisconnectChat()  
  ChatAgent1.SetReady(ACD1)
  
def ms_tserver_chat_5():
  """Chat to ChatVRP, route to ChatDN1, agent set not ready, route to ChatDN2, answer, release"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN1)
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  ChatAgent1.SetNotReady(ACD1)
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN2)
  ChatDN2.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  Customer1.SendChatMessage("Hello!")
  ChatDN2.ReleaseCall()
  Customer1.DisconnectChat()  
  ChatAgent1.SetReady(ACD1)  
  
def ms_tserver_chat_6():
  """Chat to ChatVRP, route to ChatDN1, agent trying to logout in ringing, answer, release"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN1)
  ChatAgent1.Logout(ACD1) # error
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  ChatDN1.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  Customer1.SendChatMessage("Hello!")
  ChatDN1.ReleaseCall()
  Customer1.DisconnectChat()  
  
def ms_tserver_chat_7():
  """Chat to ChatVRP, route to ChatDN1, answer, agent trying to logout in established, release"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN1)
  ChatDN1.AnswerCall()
  ChatAgent1.Logout(ACD1) # error 
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  Customer1.SendChatMessage("Hello!")
  ChatDN1.ReleaseCall()
  Customer1.DisconnectChat()    
  
def ms_tserver_chat_8():
  """Chat to ChatVRP, disconnect chat while call is on route point"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  Customer1.SendChatMessage("Hello!")
  Customer1.DisconnectChat() 
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
  

def ms_tserver_chat_9():
  """Unregister VPR when call is on VRP"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID    
  ChatVRP.Unregister()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '4')
  ChatVRP.Register()  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  Customer1.SendChatMessage("Hello!")
  Customer1.DisconnectChat() 
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)

def ms_tserver_chat_10():
  """Unregister VPR when call is routed to DN, DN is ringing"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID    
  ChatVRP.RouteCall(ChatDN1)
  ChatVRP.Unregister()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5') #????
  ChatVRP.Register()  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  ChatDN1.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN1.ReleaseCall()
  Customer1.SendChatMessage("Hello!")
  Customer1.DisconnectChat() 
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
  
def ms_tserver_chat_11():
  """Unregister VPR when call is routed to DN, DN answered"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID    
  ChatVRP.RouteCall(ChatDN1)
  ChatDN1.AnswerCall()
  ChatVRP.Unregister()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatVRP.Register()  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN1.ReleaseCall()
  Customer1.SendChatMessage("Hello!")
  Customer1.DisconnectChat() 
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)  
  
def ms_tserver_chat_12():
  """Unregister DN when DN is ringing"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID    
  ChatVRP.RouteCall(ChatDN1)
  ChatDN1.Unregister()  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatDN1.Register()   
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '1')
  ChatVRP.RouteCall(ChatDN1)  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '5')
  ChatDN1.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN1.ReleaseCall()
  Customer1.SendChatMessage("Hello!")
  Customer1.DisconnectChat() 
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)
    
    
def ms_tserver_chat_13():
  """Unregister DN when DN answered"""
  Customer1.StartChat(WebHost, ChatScript, ChatVRP)
  cl = ChatVRP.GetCall()
  interactionID = cl.interactionID    
  ChatVRP.RouteCall(ChatDN1)
  ChatDN1.AnswerCall()
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN1.Unregister()  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN1.Register()  
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = '2')
  ChatDN1.ReleaseCall()
  Customer1.SendChatMessage("Hello!")
  Customer1.DisconnectChat() 
  ChatVRP.tserver.CheckInteractionStatusByID(interactionID, expectedStatus = -1)    
  
def ms_tserver_callback_1():
  """CallBack to CallBackVRP, route to CallBackDN1, AcceptAndDial, release"""
  Customer1.RequestCallBack(WebHost, CallBackScript, VRP = CallBackVRP)
  CallBackVRP.RouteCall(CallBackDN1)
  CallBackDN1.AcceptAndDial()
  cl = CallBackDN1.GetCall()
  connID = cl.ConnID
  CallBackDN1.tserver.CheckInteractionStatusByConnID(connID, expectedStatus = '10')
  CallBackDN1.ReleaseCall()
  CallBackDN1.tserver.CheckInteractionStatusByConnID(connID, expectedStatus = -1)

def ms_tserver_callback_2():
  """CallBack to CallBackVRP, route to CallBackDN1, Decline, route to CallBackDN1, AcceptAndDial, release"""
  Customer1.RequestCallBack(WebHost, CallBackScript, VRP = CallBackVRP)
  CallBackVRP.RouteCall(CallBackDN1)
  CallBackDN1.Decline()
  for i in range(0, CallBackDN1.tserver.callBackMaxAttempts-1):
    CallBackVRP.RouteCall(CallBackDN1)
    CallBackDN1.Decline()
  
def ms_tserver_callback_3():
  """CallBack to CallBackVRP, route to CallBackDN1, Decline, route to CallBackDN1, AcceptAndDial, release"""
  Customer1.RequestCallBack(WebHost, CallBackScript, VRP = CallBackVRP)
  CallBackVRP.RouteCall(CallBackDN1)
  for i in range(0, CallBackDN1.tserver.callBackMaxAttempts-1):
    CallBackDN1.Decline()
    CallBackVRP.RouteCall(CallBackDN1)
  CallBackDN1.AcceptAndDial()
  cl = CallBackDN1.GetCall()
  connID = cl.ConnID
  CallBackDN1.tserver.CheckInteractionStatusByConnID(connID, expectedStatus = '10')
  CallBackDN1.ReleaseCall()
  CallBackDN1.tserver.CheckInteractionStatusByConnID(connID, expectedStatus = -1)
  
def ms_tserver_callback_4(): 
  """CallBack to CallBackVRP, Cancel CallBack while call is on RoutePoint"""
  Customer1.RequestCallBack(WebHost, CallBackScript, VRP = CallBackVRP)
  Customer1.CancelCallBack()  